from django.urls import path, include
from rest_framework.routers import DefaultRouter

from .views.forget_password import ForgetPasswordView
from .views.re_password import RePasswordView
from .views.refresh_token import RefreshTokenView
from .views.search.search import SearchView
from .views.product_detail.product import ProductDetailView
from .views.address_info.address_info import AddressListView
from .views.user_info.user import UserDetailView
from .views.user_update.user_update import UserUpdateView
from .views.create_order.create_order import CreateOrderView
from .views.get_order.get_order import OrderListView
from .views.address_add.address_add import AddressCreateView
from .views.delete_order.delete_order import CancelOrderView
from .views.cart_add.cart_add import AddToCartView
from .views.cart_get.cart_get import CartListView
from .views.cart_delete.cart_delete import RemoveCartItemView


from .views.code_login import LoginCode
from .views.nickname_login import LoginUsernameView
from .views.register import RegView
from .views.send_email import SendEmailCodeView


router = DefaultRouter()

urlpatterns = [
    path('search/', SearchView.as_view(), name='product-list'),

    path('address/', AddressListView.as_view(), name='address-list'),
    path('address/add', AddressCreateView.as_view(), name='address-add'),

    path('product', ProductDetailView.as_view(), name='product_detail'),

    path('info/get', UserDetailView.as_view(), name='user_detail'),
    path('info/modify', UserUpdateView.as_view(), name='user_update'),

    path('order/create', CreateOrderView.as_view(), name='create_order'),
    path('order/get', OrderListView.as_view(), name='get_order'),
    path('order/cancel', CancelOrderView.as_view(), name='cancel_order'),

    path('cart/add', AddToCartView.as_view(), name='add_to_cart'),
    path('cart/get', CartListView.as_view(), name='get_cart'),
    path('cart/delete', RemoveCartItemView.as_view(), name='del_cart'),


    path('', include(router.urls)),
    path('reg/', RegView.as_view()),
    path('email/code/', SendEmailCodeView.as_view()),
    path('login/username/', LoginUsernameView.as_view()),
    path('login/code/', LoginCode.as_view()),
    path('refresh/token/', RefreshTokenView.as_view()),
    path('forget/password/', ForgetPasswordView.as_view()),
    path('re/password/', RePasswordView.as_view()),
]
